home *** CD-ROM | disk | FTP | other *** search
/ Mixa 155: Dogs / MIXA 155: Dogs.iso / pc / Viewer / BROWSER(W) / フィルタ / PDF / LIB / pdfeof.ps < prev    next >
Encoding:
Text File  |  2002-10-29  |  1.8 KB  |  48 lines

  1. %    Copyright (C) 2000 Aladdin Enterprises.  All rights reserved.
  2. % This software is licensed to a single customer by Artifex Software Inc.
  3. % under the terms of a specific OEM agreement.
  4.  
  5. % $RCSfile: pdfeof.ps,v $ $Revision: 1.1 $
  6. % Patch to allow garbage on the end of PDF files.
  7.  
  8. .currentglobal true .setglobal
  9. pdfdict begin
  10.  
  11. % Skip backward over the %%EOF at the end of the PDF file.
  12. % We put this in a separate procedure so we can easily offer the option
  13. % of accepting garbage after the %%EOF, which the PDF specification
  14. % unambiguously forbids but which some applications (including, apparently,
  15. % Acrobat Distiller on the Macintosh) produce, and of accepting the
  16. % xref position on the same line as startxref.
  17. /findxref {        % - findxref <xrefpos>
  18.   PDFfile dup dup 0 setfileposition bytesavailable
  19.   dup /PDFfilelen exch def
  20.     % Find the last %%EOF string (within 2048 bytes)
  21.   2048 sub PDFoffset .max
  22.   2 copy setfileposition
  23.   PDFfilelen exch sub string 1 index exch readstring pop {
  24.     (\015%%EO) search {        % Adobe can handle truncated key string
  25.       pop pop            % if found, keep searching 'post' string
  26.     } {
  27.       (\012%%EO) search
  28.     { pop pop } { exit } ifelse    % exit if neither string found
  29.     } ifelse
  30.   } loop
  31.   PDFfilelen exch length sub 4 sub PDFoffset .max setfileposition
  32.     % Now read the startxref and xref start position.
  33.   prevline token not { null } if dup type /integertype eq {
  34.     exch pop cvi        % xref start position
  35.     exch PDFfile exch setfileposition
  36.     prevline (startxref) linene { findxreferror } if
  37.     pop
  38.   } {    % else, this file has 'startxref #####' format
  39.     (startxref) ne { findxreferror } if
  40.     cvi        % xref start position
  41.     exch PDFfile exch setfileposition
  42.   } ifelse
  43. } bind def
  44.  
  45. end            % pdfdict
  46. .setglobal
  47.